home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_03 / xmpl_03.sx < prev   
Encoding:
Text File  |  1996-05-21  |  1.0 KB  |  55 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 3, example 3
  5.  
  6. -- create a module to avoid naming conflicts
  7. module Scratch12 uses ScriptX end
  8. in module Scratch12
  9.  
  10. -- declare all globals used in this example code
  11. global t, r, a, i, x, b, c, keepOnGoing
  12.  
  13. -- printing examples
  14.  
  15. t := new Rect
  16. print t
  17. r := new LinkedList
  18. print r
  19. print ("r contains: " + (r as String)) 
  20.  
  21. a := "test string"
  22. prin a @normal debug
  23. prin a @debug debug
  24. prin a @unadorned debug
  25.  
  26. t := #(1,2,3,4)
  27. prin t @normal debug
  28. prin t @unadorned debug
  29. prin t @debug debug
  30.  
  31. t := #(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
  32. prin t @normal debug -- default is only 10 elements
  33. prin t @complete debug -- @complete prints all the elements
  34.  
  35. i := 15
  36. format debug "I is %*\n" i @normal
  37.  
  38. format debug "%1 and %2 are dead\n" \
  39.      #("rosencrantz", "guildenstern") #(@unadorned,@unadorned)
  40.  
  41. -- recursive output
  42. keepOnGoing := #(1,2,3)
  43. append keepOnGoing keepOnGoing
  44.  
  45. print keepOnGoing 
  46.  
  47. x := "elbow"
  48. b := #(x, x)
  49. print b
  50.  
  51. a := "elbow"
  52. b := "knee"
  53. c := #(a, b, b, a)
  54. print c
  55. -->>>